// Copyright 2023 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Foundation/Foundation.h>
#import "mediapipe/tasks/ios/core/sources/MPPTaskResult.h"

NS_ASSUME_NONNULL_BEGIN

NS_SWIFT_NAME(LanguagePrediction)
@interface MPPLanguagePrediction : NSObject

/** The i18n language / locale code for the prediction. */
@property(nonatomic, readonly) NSString *languageCode;

/** The probability for the prediction. */
@property(nonatomic, readonly) float probability;

/**
 * Initializes a new `LanguagePrediction` with the given language code and probability.
 *
 * @param languageCode The i18n language / locale code for the prediction.
 * @param probability The probability for the prediction.
 *
 * @return An instance of `LanguagePrediction` initialized with the given language code and
 * probability.
 */
- (instancetype)initWithLanguageCode:(NSString *)languageCode probability:(float)probability;

@end

/** Represents the results generated by `LanguageDetector`. **/
NS_SWIFT_NAME(LanguageDetectorResult)
@interface MPPLanguageDetectorResult : MPPTaskResult

/** A list of language predictions. */
@property(nonatomic, readonly) NSArray<MPPLanguagePrediction *> *languagePredictions;

/**
 * Initializes a new `LanguageDetectorResult` with the given array of language predictions and
 * timestamp (in milliseconds).
 *
 * @param languagePrediction The array of language predictions in this result.
 * @param timestampInMilliseconds The timestamp (in milliseconds) for this result.
 *
 * @return An instance of `LanguageDetectorResult` initialized with the given array of language
 * predictions and timestamp (in milliseconds).
 */
- (instancetype)initWithLanguagePredictions:(NSArray<MPPLanguagePrediction *> *)languagePredictions
                    timestampInMilliseconds:(NSInteger)timestampInMilliseconds;

- (instancetype)initWithTimestampInMilliseconds:(NSInteger)timestampInMilliseconds NS_UNAVAILABLE;

- (instancetype)init NS_UNAVAILABLE;

+ (instancetype)new NS_UNAVAILABLE;

@end

NS_ASSUME_NONNULL_END
